package com.liao.badminton.dto;

import com.liao.badminton.code.util.NameUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jetbrains.annotations.NotNull;

import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.List;

/**
* @author liaocheng
* @date 2024-11-01
* description:单局详情表
*/
@Data
public class StatDto {
    @ApiModelProperty(value = "录入记录id")
    private Long importRecordId;
    @ApiModelProperty(value = "群id")
    private Long groupId;
    @ApiModelProperty(value = "用户和群id:查询个人战绩时用")
    private Long userGroupRefId;
    @ApiModelProperty(value = "查询队员1名称:红白")
    private String teamOneName = "";
    @ApiModelProperty(value = "查询队员1名称倒序:白红,前端可以不用理")
    private String teamOneNameOrder;
    @ApiModelProperty(value = "查询名称:")
    private String teamTwoName = "";
    @ApiModelProperty(value = "查询对手名称")
    private String teamTwoNameOrder;

    @ApiModelProperty(value = "查询类型：1-单人，2-队伍,3队伍对战查询")
    private Integer type1;
    @ApiModelProperty(value = "查询类型：1-单人，2-队伍,3队伍对战查询")
    private Integer type2;

    @ApiModelProperty(value = "榜单数据:Map<key=排名类型：1-总榜，2-年榜，3-月榜,4-周榜,5-日榜，List<StatVo>>")
    private Integer selectType =1;

    @ApiModelProperty(value = "开始时间")
    private Date startTime;
    @ApiModelProperty(value = "结束时间")
    private Date endTime;

    @ApiModelProperty(value = "0总榜,1年榜,2半年, 3月榜, 4周榜, 5日榜")
    private Integer findTimeType =0;
    @ApiModelProperty(value = "1：总奖励，2：胜率，3：总局数，4：打水次数，5：活动次数，6：消费")
    private Integer orderByType = 1 ;
    @ApiModelProperty(value = "1：升序(小->大)，2：降序（大->小）")
    private Integer orderByTypeDesc =2;



    public String handStringOrder(String name, Integer type,Long groupId) {
        if (name.length()>1 && (type == 2 ||type == 3)) {
            List<String> names = NameUtil.findNames(name, type, groupId);
            String a = names.get(1);
            String b = names.get(0);
            return name.equals(a+b)?b+a:a+b;
        }else{
            return name;
        }
    }

}
